home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / dev / cross / pkginfo.lha / pkginfo / pkgsplit.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1998-04-03  |  2.3 KB  |  85 lines

  1. /* $VER: pkginfo/split 0.6 $ */
  2. /* information about/split AppleLink package */
  3. /* © by Stefan Haubenthal 1997/98 */
  4. align=8
  5. parse source . . "pkg"arg0 .
  6. if ~arg() then exit 0*writeln(stdout,"Usage: pkg"arg0" name[.pkg]")
  7. parse arg name".pkg"
  8. call open(file,name".pkg")
  9. if ~abbrev(readch(file,8),"package") then exit 10
  10. if arg0="split" then address command makedir name
  11. call seek(file,4)/* xxxx */
  12. say "packageFlags:        "c2x(readch(file,4))
  13. say "versionNo:        "c2d(readch(file,4))
  14. call seek(file,2)/* \0\0 */
  15. acl=c2d(readch(file,2))
  16. say "authorCopyrightLength:    "acl
  17. call seek(file,2)
  18. pnl=c2d(readch(file,2))
  19. say "packageNameLength:    "pnl
  20. say "packageLength:        "c2d(readch(file,4))
  21. say "createdTimeStamp:    "c2d(readch(file,4))
  22. say "modifiedTimeStamp:    "c2d(readch(file,4))
  23. call seek(file,4)/* \0\0\0\0 */
  24. fro=c2d(readch(file,4))
  25. say "firstRecordOffset:    "fro
  26. say "partCount:        "c2d(readch(file,4))
  27. call seek(file,4)/* \0\0\0\0 */
  28. say "partOffset:        "c2d(readch(file,4))
  29. say "lengthOfData:        "c2d(readch(file,4))
  30. say "partType:        "readch(file,4)
  31. call seek(file,4)/* \0\0\0\0 */
  32. call seek(file,4)/* \0\0\0 0x81 */
  33. say "partStringOffset:    "c2d(readch(file,2))
  34. say "partStringLength:    "c2d(readch(file,2))
  35. call seek(file,4)/* \0\0\0\0 */
  36. say
  37. say readch(file,acl)
  38. say readch(file,pnl)
  39. say
  40. if arg0="split" then do
  41.     call open(file2,name"/0",W)
  42.     call seek(file,0,B)
  43.     call writech(file2,readch(file,fro))
  44.     call close(file2)
  45. end
  46. call seek(file,fro,B)
  47. do i=1
  48.     len=c2d(readch(file,3))
  49.     if eof(file) then leave
  50.     type=readch(file)
  51.     call seek(file,4)/* \0\0\0\0 */
  52.     rec=readch(file,len-8)
  53.     if len>65535 then call seek(file,len-8-65535)
  54.     if len//align>0 then call seek(file,align-len//align)
  55.     select
  56.         when type=@ then call data
  57.         when type=A then call array
  58.         when type=C then call frame
  59.     end
  60.     if arg0="split" then do
  61.         call open(file2,name"/"i,W)
  62.         call writech(file2,d2c(len,3)type"00000000"x||rec)
  63. /*        if len//align>0 then call writech(file2,copies("00"x,align-len//align))*/
  64.         call close(file2)
  65.     end
  66. end
  67. exit
  68.  
  69. DATA:
  70. class=c2x(left(rec,4))
  71. select
  72.     when class="00055552" then say i"    "type len"    "class substr(rec,9)
  73.     when class="0000064D" then say i"    "type len"    "class translate(substr(rec,5),copies("7f"x,31),xrange("01"x,"1f"x))
  74.     otherwise say i"    "type len"    "class
  75. end
  76. return
  77.  
  78. ARRAY:
  79. say i"    "type len
  80. return
  81.  
  82. FRAME:
  83. say i"    "type len
  84. return
  85.